package com.raincat.tools.permissiontools;

import java.lang.ref.WeakReference;

/**
 * <pre>
 *     author : RainCat
 *     org    : Shenzhen JingYu Network Technology Co., Ltd.
 *     e-mail : nining377@gmail.com
 *     time   : 2020/05/13
 *     desc   : 权限获取监听
 *     version: 1.0
 * </pre>
 */
class PermissionProxyListenerManager {
    private PermissionProxyListener permissionProxyListener;
    private static PermissionProxyListenerManager manager;

    public static PermissionProxyListenerManager getInstance() {
        if (manager == null)
            manager = new PermissionProxyListenerManager();
        return manager;
    }

    void setPermissionProxyListenerListener(PermissionProxyListener permissionProxyListener) {
        this.permissionProxyListener = permissionProxyListener;
    }

    void onPermissionGet(boolean get) {
        if (permissionProxyListener != null) {
            permissionProxyListener.onPermissionGet(get);
        }
    }

    void onDestroy() {
        permissionProxyListener = null;
        manager = null;
    }
}
